<?php
	require_once("config.php");
	    
    if ($_GET['confirmed'] == true) {
    	DBM::Execute("DELETE FROM listing_data WHERE listingid=$_GET[id];");
    	DBM::Execute("DELETE FROM listings WHERE id = $_GET[id];");
    	header("Location: $_GET[refer_to]");
    }
    else {
	    Functions::PrintHeader("Home");
	    
	    InfoMessage::Show("Are you sure?",
	    	"<form method='get' action='unlist.php'>" .
	    	"Are you sure you want to delete this listing?<br />"
	    );
	    
	    echo "<hr /><div style='text-align:right; font-size:12pt;'>" .
	    	"<input type='hidden' name='refer_to' value='" . $_SERVER['HTTP_REFERER'] . "' />" .
	    	"<input type='hidden' name='id' value='" . $_GET['id'] . "' />" .
	    	"<input type='hidden' name='confirmed' value='yes' />" . 
	    	"<input type='submit' style='margin-left:10px;' value='Yes' />" .
	    	"<input type='button' class='prev' onClick='javascript:history.back(-1)' value='No' />" . 
	    	"</div>";
	    
	    Functions::PrintFooter();
	}
?>